package jk.fox.engine;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * Rpc注册表
 * @author cuichao
 * @Description: RpcNodeDefinition
 * @Date: create in 2020/4/12 17:49
 */
@Getter
@Setter
@NoArgsConstructor
public class RpcNodeDefinition {
    /**
     * rpc的ID
     */
    private String id = null;
    /**
     * rpc-interface simpleName
     */
    private String name = null;
    /**
     * class
     */
    private Class target = null;
    /**
     * 是否注册为consumer
     */
    private  boolean consumer = false;
    /**
     * 是否注册为provider
     */
    private  boolean provider = false;
    /**
     * 是否开启重试
     */
    private Boolean enableRetry;
    /**
     * 最大重试次数
     */
    private Integer maxRetires = null;
    /**
     * 超时时间
     */
    private Long timeoutMS = null;


    public RpcNodeDefinition(Class target) {
        this.target = target;
        this.id = target.getName();
        this.name = target.getSimpleName();
    }


    public RpcNodeDefinition(String id, Class target) {
        this.id = id;
        this.target = target;
        this.name = target.getSimpleName();
    }


}
